//! Storage layer for Redis-rs2
//! 
//! This module provides the core data storage functionality including:
//! - SingleThreadStorage: Redis-style single-thread storage engine (HashMap with SipHash)
//! - HighPerformanceStorage: High-performance storage with FxHash algorithm  
//! - BytesOptimizedStorage: 字节数组优化存储引擎 (零String分配)
//! - AbstractedStorage: Interface-based storage with pluggable Map implementations
//! - SingleThreadCommandDispatcher: Unified command processing
//! - DataType trait for all value types
//! - Specific data type implementations (String, Int, Hash, List, Set, SortedSet)
//! - Legacy multi-thread components (已删除)
//! - Map abstractions and skip_list (已移至core模块或删除)

// 注意：已删除的legacy模块：storage_manager, command_dispatcher, abstracted_storage, map_traits, skip_list

pub mod data_types;
pub mod transaction;
pub mod ttl;
pub mod command;
pub mod single_thread_storage;
pub mod single_thread_dispatcher;
pub mod high_performance_storage;  // FxHash-based storage
pub mod bytes_optimized_storage;   // 字节数组优化存储
pub mod global_storage;  // 全局共享存储管理器
pub mod single_thread_redis;  // 真正的单线程Redis服务器（零锁设计）
// 注意: map_traits、skip_list、abstracted_storage 已删除



// Re-export commonly used types
pub use data_types::*;
// 注意: SkipList, Map traits 等已从 core 模块导入或删除
pub use transaction::*;
pub use ttl::*;
pub use command::*;

// Legacy导出（已删除）
// pub use storage_manager::Storage;
// pub use command_dispatcher::*;

// New single-thread exports
pub use single_thread_storage::{SingleThreadStorage, StorageStats};
pub use single_thread_dispatcher::{
    SingleThreadCommandDispatcher, 
    CommandHandlerStats, 
    SingleThreadDispatcherStats
};

// High-performance exports  
pub use high_performance_storage::{
    HighPerformanceStorage,
    HighPerformanceStorageStats
};

// 字节数组优化存储导出
pub use bytes_optimized_storage::{
    BytesOptimizedStorage,
    BytesDataType,
    StorageStats as BytesStorageStats
};

// 全局存储管理器
pub use global_storage::GlobalStorageManager;

// 真正的单线程Redis服务器（零锁设计）
pub use single_thread_redis::{SingleThreadRedisServer, RedisCommand, SingleThreadRedisStats};

// 服务器模式枚举
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum RedisServerMode {
    Standalone,
    Cluster,
}

impl Default for RedisServerMode {
    fn default() -> Self {
        RedisServerMode::Standalone
    }
}

// 与single_thread_redis模块中的RedisServerMode的转换
impl From<RedisServerMode> for single_thread_redis::RedisServerMode {
    fn from(mode: RedisServerMode) -> Self {
        match mode {
            RedisServerMode::Standalone => single_thread_redis::RedisServerMode::Standalone,
            RedisServerMode::Cluster => single_thread_redis::RedisServerMode::Cluster,
        }
    }
}

impl From<single_thread_redis::RedisServerMode> for RedisServerMode {
    fn from(mode: single_thread_redis::RedisServerMode) -> Self {
        match mode {
            single_thread_redis::RedisServerMode::Standalone => RedisServerMode::Standalone,
            single_thread_redis::RedisServerMode::Cluster => RedisServerMode::Cluster,
        }
    }
}

// Abstract layer exports (已删除或移至core模块)
// 注意: AbstractedStorage, Map traits 等已删除